var _timer = 30000;
var _split = 1;
var _id = 0;
var _top05 = new Array(5); // e 05 W
var _top10 = new Array(10); // e 10 W
var _status = "资料读取中...";

var g_numcolor = [0,1,1,2,2,3,3,1,1,2,2,3,1,1,2,2,3,3,1,1,2,3,3,1,1,2,2,3,3,1,1,2,3,3,1,1,2,2,3,3,1,2,2,3,3,1,1,2,2,3];
var colors = ["","red", "blue", "green"];

var XH = null;
var XH1= null;
if (window.XMLHttpRequest)
{// code for all new browsers
    XH = new XMLHttpRequest();
    XH1 = new XMLHttpRequest();
}
else if (window.ActiveXObject)
{// code for IE5 and IE6
  XH = new ActiveXObject("Microsoft.XMLHTTP");
  XH1 = new ActiveXObject("Microsoft.XMLHTTP");
} else 
  alert("Your browser does not support XMLHTTP.");

var timer_id;

var btn0_choice = 11;
var btn1_choice = 0.5;

var bo1_num = 0;
var bo2_num = 0;

var chint_check = false;
var sound_check = false;
//   Math.round(n) = 去小数取整数，Math.floor(n) = 四舍五入到整数

function bo()
{
	SetCookie("bo1", document.all.bo1.value);
	SetCookie("bo2", document.all.bo2.value);
	bo1_num = document.all.bo1.value-0;
	bo2_num = document.all.bo2.value-0;
	if (timer_id) clearTimeout(timer_id);
	timer();
}

function cb()
{
	SetCookie("chkhint", document.all.chkhint.checked);
	chint_check = document.all.chkhint.checked;
	if (timer_id) clearTimeout(timer_id);
	timer();
}

function cs()
{
	SetCookie("chksound", document.all.chksound.checked);
	sound_check = document.all.chksound.checked;
	if (timer_id) clearTimeout(timer_id);
	timer();
}

function chsbtn(t)
{
	if (t > 10) {
		document.all.btn011.className = "btnchoice";
		document.all.btn012.className = "btnchoice";
		document.all.btn013.className = "btnchoice";
		document.all.btn014.className = "btnchoice";
		document.all.btn015.className = "btnchoice";
		document.all.btn016.className = "btnchoice";
		document.all.btn017.className = "btnchoice";
		document.all.btn018.className = "btnchoice";
		document.all.btn019.className = "btnchoice";
		document.all.btn020.className = "btnchoice";
		document.all.btn021.className = "btnchoice";
		document.all.btn022.className = "btnchoice";
		document.all.btn023.className = "btnchoice";
		document.all.btn024.className = "btnchoice";
		document.all.btn025.className = "btnchoice";
		document.all.btn026.className = "btnchoice";
		document.all.btn027.className = "btnchoice";
		document.all.btn028.className = "btnchoice";
		document.all.btn029.className = "btnchoice";
		document.all.btn030.className = "btnchoice";
		document.all.btn031.className = "btnchoice";
		document.all.btn032.className = "btnchoice";
		document.all.btn033.className = "btnchoice";
		document.all.btn034.className = "btnchoice";
		document.all.btn035.className = "btnchoice";
		document.all.btn036.className = "btnchoice";
		document.all.btn037.className = "btnchoice";
		document.all.btn038.className = "btnchoice";
		document.all.btn039.className = "btnchoice";
		document.all.btn040.className = "btnchoice";
		event.srcElement.className = "btnchoiced";
		btn0_choice = t;
	} else {
		document.all.btn05.className = "btnchoice";
		document.all.btn04.className = "btnchoice";
		document.all.btn03.className = "btnchoice";
		document.all.btn02.className = "btnchoice";
		document.all.btn01.className = "btnchoice";
		document.all.btn005.className = "btnchoice";
		document.all.btn004.className = "btnchoice";
		document.all.btn003.className = "btnchoice";
		document.all.btn002.className = "btnchoice";
		document.all.btn001.className = "btnchoice";
		document.all.btn0005.className = "btnchoice";
		document.all.btn0003.className = "btnchoice";
		document.all.btn0001.className = "btnchoice";
    document.all.btn00005.className = "btnchoice";
    document.all.btn00001.className = "btnchoice";        
		event.srcElement.className = "btnchoiced";
		btn1_choice = t;
      
	}
}

function btnratediff(t)
{
	// window.status = "Cange Rate....";
	if (timer_id) clearTimeout(timer_id);
	var uu = "op.php?op=admin&fp=ratediff&id="+_id+"&bettype=A&number="+btn0_choice+"&rate="+(btn1_choice*t)+"&pagename=0&method=1";
	if (btn0_choice==21) {
		uu+="&top10=";
		for (var i=0; i<10; i++) {
			uu+=_top10[i];
			if (i<9) { uu+=","; }
		}
	} else if (btn0_choice==24) {
		uu+="&top05=";
		for (var i=0; i<5; i++) {
			uu+=_top05[i];
			if (i<4) { uu+=","; }
		}
	}
	//window.open(uu);//debug用
	//return false;//debug
	XH1.open("POST", uu, false); 
    try{XH1.send("");}catch(E){}
	window.status = "";
    timer();
}

function getcontent()
{
  XH.open("POST", "op.php?op=xml&fp=now1&id="+_id+"&t="+(new Date()).getTime(),false);
	try{XH.send(null);return XH.responseText; }catch(E){}
}

function timer()
{
	window.status = _status;
	var str = getcontent();
	if (str=="") { alert("Error 1"); }
	else if (str=="-1") { location.reload(); }
	
  var a = str.split("\n");
	show_rate0(a[0]);
	show_rate1(a[1]);
	show_rate2(a[2]);
	show_rate3(a[3]);
	show_rate13(a[4]);
	show_rate14(a[5]);
	show_rate18(a[6]);
	show_rate20(a[7]);
	show_rate28(a[8]);
	show_rate30(a[9]);
	//show_rate46(a[10]);
	show_rate47(a[10]);
	show_rate49(a[11]);
	show_rate50(a[12]);
	show_titleAmu(a[13]);
	window.status = "";
	timer_id = setTimeout("timer()", _timer);
}

function show_rate20(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate20_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount20_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist&dt1="+_open+"&dt2="+_open+"&bettype=20&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount20_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg20_"+i].innerHTML = "<input type=button onclick=\"ratediff(20,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(20,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win20_"+i].innerHTML = win1;
		document.all["win20_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
  document.getElementById("amount20").innerHTML=Math.floor(amount0);
}

function show_rate18(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<13; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["num18_"+i].innerHTML = _name18[i];
		document.all["rate18_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount18_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist&dt1="+_open+"&dt2="+_open+"&bettype=18&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount18_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg18_"+i].innerHTML = "<input type=button onclick=\"ratediff(18,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(18,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win18_"+i].innerHTML = win1;
		document.all["win18_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	//document.all.amount18.innerHTML=Math.floor(amount0);
  document.getElementById("amount18").innerHTML=Math.floor(amount0);
}

function show_rate14(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<13; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["num14_"+i].innerHTML = _name14[i];
		document.all["rate14_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount14_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=14&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount14_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg14_"+i].innerHTML = "<input type=button onclick=\"ratediff(14,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(14,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win14_"+i].innerHTML = win1;
		document.all["win14_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount14.innerHTML=Math.floor(amount0);
  
}

function show_rate13(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<4; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate13_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount13_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=13&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount13_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg13_"+i].innerHTML = "<input type=button onclick=\"ratediff(13,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(13,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win13_"+i].innerHTML = win1;
		document.all["win13_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount13.innerHTML=Math.floor(amount0);
}

function show_rate3(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate3_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount3_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=3&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount3_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg3_"+i].innerHTML = "<input type=button onclick=\"ratediff(3,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(3,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win3_"+i].innerHTML = win1;
		document.all["win3_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount3.innerHTML=Math.floor(amount0);
}

function show_rate2(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate2_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount2_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=2&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount2_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg2_"+i].innerHTML = "<input type=button onclick=\"ratediff(2,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(2,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win2_"+i].innerHTML = win1;
		document.all["win2_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount2.innerHTML=Math.floor(amount0);
}

function show_rate1(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate1_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount1_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=1&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount1_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg1_"+i].innerHTML = "<input type=button onclick=\"ratediff(1,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(1,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win1_"+i].innerHTML = win1;
		document.all["win1_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount1.innerHTML=Math.floor(amount0);
}

function show_rate28(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate28_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount28_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=28&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount28_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg28_"+i].innerHTML = "<input type=button onclick=\"ratediff(28,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(28,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win28_"+i].innerHTML = win1;
		document.all["win28_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount28.innerHTML=Math.floor(amount0);
}

function show_rate30(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate30_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount30_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=30&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount30_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg30_"+i].innerHTML = "<input type=button onclick=\"ratediff(30,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(30,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win30_"+i].innerHTML = win1;
		document.all["win30_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	//document.all.amount30.innerHTML=Math.floor(amount0);
  document.getElementById("amount30").innerHTML=Math.floor(amount0);
}

function show_rate0(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var a1 = a0[0].split("@");
	var uamount = a1[0]-0;
	var win = a1[1]-0;
	var bethint = a1[2]-0;
	var i = 0;
	var j = 0;
	for (i=1; i<50; i++) {
		a00 = a0[i].split("@");
		num = a00[0];
		if (j<10) {
			_top10[j] = num;
			if (j<5) {
				_top05[j] = num;
			}
			j++;
		}
		num2 = (num < 10 ? "0"+num : num);
		rate = a00[1];
		count = a00[2]-0;
		amount = a00[3]-0;
		document.getElementById("num0_"+i).innerHTML = num2;
		document.getElementById("num0_"+i).className = "td1"+colors[g_numcolor[num]];
		document.getElementById("rate0_"+i).innerHTML = rate;
		if (count > 0) {
			document.getElementById("amount0_"+i).innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=99&numbers="+num2+">"+Math.floor(amount)+"</a>";
		} else {
			document.getElementById("amount0_"+i).innerHTML = Math.floor(amount);
		}
		document.getElementById("chg0_"+i).innerHTML = "<input type=button onclick=\"ratediff0('"+num2+"',-1,"+i+")\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff0('"+num2+"',1,"+i+")\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[4]);
		document.getElementById("win0_"+i).innerHTML = win1;
		document.getElementById("win0_"+i).className = (win1 < 0 ? "lost" : "win");
		if (win1 < bo2_num) {
			i2 = bo2_num - win1;
			i2 = parseInt(i2 / bo1_num);
			i2 = Math.round(i2);
			document.getElementById("bo_"+i).innerHTML = i2;
		} else {
			document.getElementById("bo_"+i).innerHTML = '';
		}
		count0+=count;
		amount0+=amount;
	}
	document.all.online_sum.innerHTML = (uamount);
	document.all.amount0.innerHTML=Math.floor(amount0);

	if (bethint>0) {
		if (chint_check && sound_check) {
			hint_list(bethint, 2);
		} else if (chint_check && !sound_check) {
			hint_list(bethint, 1);
		} else if (!chint_check && sound_check) {
			hint_list(bethint, 0);
		}
	}
}

function show_rate0x(str, n, i)
{
	var a0 = str.split(",");
	var a1 = a0[0].split("@");
	a00 = a0[n].split("@");
	rate = a00[1];
	document.all["rate0_"+i].innerHTML = rate;
}

function show_rate46(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<4; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate46_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount46_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=46&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount46_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg46_"+i].innerHTML = "<input type=button onclick=\"ratediff(46,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(46,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win46_"+i].innerHTML = win1;
		document.all["win46_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount46.innerHTML=Math.floor(amount0);
}

function show_rate47(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	var i = 0;
	for (i=1; i<3; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate47_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount47_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=47&numbers="+i+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount47_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg47_"+i].innerHTML = "<input type=button onclick=\"ratediff(47,'"+i+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(47,'"+i+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win47_"+i].innerHTML = win1;
		document.all["win47_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount47.innerHTML=Math.floor(amount0);
}
function show_rate49(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<=5; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate49_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount49_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=49&numbers="+(i-1)+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount49_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg49_"+i].innerHTML = "<input type=button onclick=\"ratediff(49,'"+(i-1)+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(49,'"+(i-1)+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win49_"+i].innerHTML = win1;
		document.all["win49_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount49.innerHTML=Math.floor(amount0);
}
function show_rate50(str)
{
	var count0 = 0;
	var amount0 = 0;
	var a0 = str.split(",");
	var win = a0[0];
	for (i=1; i<=9; i++) {
		a00 = a0[i].split("@");
		rate = a00[0];
		count = a00[1]-0;
		amount = a00[2]-0;
		document.all["rate50_"+i].innerHTML = rate;
		if (count > 0) {
			document.all["amount50_"+i].innerHTML = "<a href=op.php?op=agent&fp=betlist1&dt1="+_open+"&dt2="+_open+"&bettype=50&numbers="+(i-1)+">"+Math.floor(amount)+"</a>";
		} else {
			document.all["amount50_"+i].innerHTML = Math.floor(amount);
		}
		document.all["chg50_"+i].innerHTML = "<input type=button onclick=\"ratediff(50,'"+(i-1)+"',-1)\" value=- class=btnmin>&nbsp;<input type=button onclick=\"ratediff(50,'"+(i-1)+"',1)\" value=+ class=btnplus>";
		win1 = Math.floor(win - a00[3]);
		document.all["win50_"+i].innerHTML = win1;
		document.all["win50_"+i].className = (win1 < 0 ? "lost" : "win");
		count0+=count;
		amount0+=amount;
	}
	document.all.amount50.innerHTML=Math.floor(amount0);
}
function show_titleAmu(str)
{
	var a0 = str.split(",");
	var i = 0;
	var l = a0.length;
	var amu = 0;
	var clr = '';
	var oObj = '';
	for (i=0; i<l; i++) {
		a00 = a0[i].split("@");
		amu = a00[0];
		if(a00[1] > 0){ clr = '#ffff99';  }else{ clr = 'transparent';  }
    oObj = document.getElementById("menuAmu"+i);
    oObj.innerHTML = amu;
    oObj.style.backgroundColor = clr;
	}
}

function gen_rate0()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>";
	for (i=0; i<5; i++)
		ret += _tb0head;
	ret += "</tr>";
	
	for (j=1; j<=10; j++) {
		ret += "<tr class=td2 align=right>";
		for (i=0; i<5; i++) {
			k = i*10 + j;
			if (k > 49) {
				ret += "<td colspan=6>"+_total+" <b id=amount0></b></td>";
			} else {
				ret += "<td id=num0_"+k+"></td><td nowrap id=amount0_"+k+"></td><td nowrap id=win0_"+k+"></td><td nowrap id=bo_"+k+"></td><td nowrap id=rate0_"+k+" class=rate></td><td align=center id=chg0_"+k+"></td>";
			}
		}
	}
	ret += "</table>";
	//document.all.div0.innerHTML = ret;
  document.getElementById("div0").innerHTML = ret;
}

function gen_rate28()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name28[1]+"</td><td nowrap id=amount28_1></td><td nowrap id=win28_1></td><td id=rate28_1 class=rate></td><td align=center id=chg28_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name28[2]+"</td><td nowrap id=amount28_2></td><td nowrap id=win28_2></td><td id=rate28_2 class=rate></td><td align=center id=chg28_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount28></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div28.innerHTML = ret;
  document.getElementById("div28").innerHTML = ret;
}

function gen_rate30()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name30[1]+"</td><td nowrap id=amount30_1></td><td nowrap id=win30_1></td><td id=rate30_1 class=rate></td><td align=center id=chg30_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name30[2]+"</td><td nowrap id=amount30_2></td><td nowrap id=win30_2></td><td id=rate30_2 class=rate></td><td align=center id=chg30_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount30></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div30.innerHTML = ret;
  document.getElementById("div30").innerHTML = ret;
}

function gen_rate1()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name1[1]+"</td><td nowrap id=amount1_1></td><td nowrap id=win1_1></td><td id=rate1_1 class=rate></td><td align=center id=chg1_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name1[2]+"</td><td nowrap id=amount1_2></td><td nowrap id=win1_2></td><td id=rate1_2 class=rate></td><td align=center id=chg1_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount1></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div1.innerHTML = ret;
  document.getElementById("div1").innerHTML = ret;
}

function gen_rate2()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2[1]+"</td><td nowrap id=amount2_1></td><td nowrap id=win2_1></td><td id=rate2_1 class=rate></td><td align=center id=chg2_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2[2]+"</td><td nowrap id=amount2_2></td><td nowrap id=win2_2></td><td id=rate2_2 class=rate></td><td align=center id=chg2_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount2></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div2.innerHTML = ret;
  document.getElementById("div2").innerHTML = ret;
}

function gen_rate2a()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2a[1]+"</td><td nowrap id=amount20_1></td><td nowrap id=win20_1></td><td id=rate20_1 class=rate></td><td align=center id=chg20_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name2a[2]+"</td><td nowrap id=amount20_2></td><td nowrap id=win20_2></td><td id=rate20_2 class=rate></td><td align=center id=chg20_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount20></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div2a.innerHTML = ret;
  document.getElementById("div2a").innerHTML = ret;
}

function gen_rate3()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name3[1]+"</td><td nowrap id=amount3_1></td><td nowrap id=win3_1></td><td id=rate3_1 class=rate></td><td align=center id=chg3_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name3[2]+"</td><td nowrap id=amount3_2></td><td nowrap id=win3_2></td><td id=rate3_2 class=rate></td><td align=center id=chg3_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount3></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div3.innerHTML = ret;
  document.getElementById("div3").innerHTML = ret;
}

function gen_rate13()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name13[1]+"</td><td nowrap id=amount13_1></td><td nowrap id=win13_1></td><td id=rate13_1 class=rate></td><td align=center id=chg13_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name13[2]+"</td><td nowrap id=amount13_2></td><td nowrap id=win13_2></td><td id=rate13_2 class=rate></td><td align=center id=chg13_2></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name13[3]+"</td><td id=amount13_3></td><td nowrap id=win13_3></td><td id=rate13_3 class=rate></td><td align=center id=chg13_3></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount13></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div13.innerHTML = ret;
  document.getElementById("div13").innerHTML = ret;
}

function gen_rate14()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>";
	for (i=0; i<2; i++) ret += _tb14head;
	ret += "</tr>";
	
	for (j=0; j<6; j++) {
		ret += "<tr class=td2 align=right>";
		for (i=1; i<3; i++) {
			k = i + j*2;
			ret += "<td id=num14_"+k+" class=td6 align=center></td><td nowrap id=amount14_"+k+"></td><td nowrap id=win14_"+k+"></td><td id=rate14_"+k+" class=rate></td><td align=center id=chg14_"+k+"></td>";
		}
	}
	ret += "</table>";
	//document.all.div14.innerHTML = ret;
  document.getElementById("div14").innerHTML = ret;
}

function gen_rate18()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>";
	for (i=0; i<2; i++) ret += _tb18head;
	ret += "</tr>";
	
	for (j=0; j<6; j++) {
		ret += "<tr class=td2 align=right>";
		for (i=1; i<3; i++) {
			k = i + j*2;
			ret += "<td id=num18_"+k+" class=td6 align=center></td><td nowrap id=amount18_"+k+"></td><td nowrap id=win18_"+k+"></td><td id=rate18_"+k+" class=rate></td><td align=center id=chg18_"+k+"></td>";
		}
	}
	ret += "</table>";
	//document.all.div18.innerHTML = ret;
  document.getElementById("div18").innerHTML = ret;
}
function gen_rate46()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0>"+_tb46head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name46[1]+"</td><td nowrap id=amount46_1></td><td nowrap id=win46_1></td><td id=rate46_1 class=rate></td><td align=center id=chg46_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name46[2]+"</td><td nowrap id=amount46_2></td><td nowrap id=win46_2></td><td id=rate46_2 class=rate></td><td align=center id=chg46_2></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15>"+_name46[3]+"</td><td id=amount46_3></td><td nowrap id=win46_3></td><td id=rate46_3 class=rate></td><td align=center id=chg46_3></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount46></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div46.innerHTML = ret;
  document.getElementById("div46").innerHTML = ret;
}

function gen_rate47()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb1head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name47[1]+"</td><td nowrap id=amount47_1></td><td nowrap id=win47_1></td><td id=rate47_1 class=rate></td><td align=center id=chg47_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name47[2]+"</td><td nowrap id=amount47_2></td><td nowrap id=win47_2></td><td id=rate47_2 class=rate></td><td align=center id=chg47_2></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount47></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
	//document.all.div47.innerHTML = ret;
  document.getElementById("div47").innerHTML = ret;
}
function gen_rate49()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb49head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[0]+"</td><td nowrap id=amount49_1></td><td nowrap id=win49_1></td><td id=rate49_1 class=rate></td><td align=center id=chg49_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[1]+"</td><td nowrap id=amount49_2></td><td nowrap id=win49_2></td><td id=rate49_2 class=rate></td><td align=center id=chg49_2></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[2]+"</td><td nowrap id=amount49_3></td><td nowrap id=win49_3></td><td id=rate49_3 class=rate></td><td align=center id=chg49_3></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[3]+"</td><td nowrap id=amount49_4></td><td nowrap id=win49_4></td><td id=rate49_4 class=rate></td><td align=center id=chg49_4></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name49[4]+"</td><td nowrap id=amount49_5></td><td nowrap id=win49_5></td><td id=rate49_5 class=rate></td><td align=center id=chg49_5></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount49></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
  document.getElementById("div49").innerHTML = ret;
}
function gen_rate50()
{
	ret = "<table width=100% cellpadding=2 cellspacing=1 border=0 class=table0>"
		+"<tr id=rate0hd class=td0 align=center>"+_tb50head+"</tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[0]+"</td><td nowrap id=amount50_1></td><td nowrap id=win50_1></td><td id=rate50_1 class=rate></td><td align=center id=chg50_1></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[1]+"</td><td nowrap id=amount50_2></td><td nowrap id=win50_2></td><td id=rate50_2 class=rate></td><td align=center id=chg50_2></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[2]+"</td><td nowrap id=amount50_3></td><td nowrap id=win50_3></td><td id=rate50_3 class=rate></td><td align=center id=chg50_3></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[3]+"</td><td nowrap id=amount50_4></td><td nowrap id=win50_4></td><td id=rate50_4 class=rate></td><td align=center id=chg50_4></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[4]+"</td><td nowrap id=amount50_5></td><td nowrap id=win50_5></td><td id=rate50_5 class=rate></td><td align=center id=chg50_5></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[5]+"</td><td nowrap id=amount50_6></td><td nowrap id=win50_6></td><td id=rate50_6 class=rate></td><td align=center id=chg50_6></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[6]+"</td><td nowrap id=amount50_7></td><td nowrap id=win50_7></td><td id=rate50_7 class=rate></td><td align=center id=chg50_7></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[7]+"</td><td nowrap id=amount50_8></td><td nowrap id=win50_8></td><td id=rate50_8 class=rate></td><td align=center id=chg50_8></td></tr>";
	ret += "<tr class=td2 align=right><td class=td15 align=center>"+_name50[8]+"</td><td nowrap id=amount50_9></td><td nowrap id=win50_9></td><td id=rate50_9 class=rate></td><td align=center id=chg50_9></td></tr>";
	ret += "<tr class=td6 align=right><td class=td0>"+_total+"</td><td id=amount50></td><td></td><td></td><td></td></tr>";
	ret += "</table>";
  document.getElementById("div50").innerHTML = ret;
}
function ratediff(btype, num, rate)
{
	// window.status = "Cange Rate....";
	if (timer_id) clearTimeout(timer_id);
		//window.open("op.php?op=admin&fp=ratediff&id="+_id+"&bettype="+btype+"&number="+num+"&rate="+rate+"&pagename=0&method=0");//debug用
	  //return false;//debug
    XH1.open("POST", "op.php?op=admin&fp=ratediff&id="+_id+"&bettype="+btype+"&number="+num+"&rate="+rate+"&pagename=0&method=0",false); 
    try{XH1.send("");}catch(E){}
    window.status = "";
    timer();
}

function ratediff0(num, t, i)
{
	//window.status = "Cange Rate....";
	if (timer_id) clearTimeout(timer_id);
		//window.open("op.php?op=admin&fp=ratediff&id="+_id+"&bettype=0&number="+num+"&rate="+(btn1_choice*t)+"&pagename=0&method=0");//debug用
	  //return false;//debug
    XH1.open("POST", "op.php?op=admin&fp=ratediff&id="+_id+"&bettype=0&number="+num+"&rate="+(btn1_choice*t)+"&pagename=0&method=0",false); 
    try{XH1.send("");}catch(E){}
    window.status = "";
    timer();
}

function hint_list(count, show_mode)
{
	var bw = 440;
	var X = screen.width - 450;
	var Y = 0;
	var hi =88 + (count * 26);
	if (count > 24) {
		hi = 716;
		X = screen.width - 468;
		bw = 458
	}
	if (show_mode == 0) {
		var newwin = window.open("op.php?op=admin&fp=hintlist1&id="+_id,'WinPopList','menubar=no,status=no,scrollbars=no,toolbar=no,top=0,left='+screen.width+',width=1,height=1,titlebar=no');
	} else {
		var newwin = window.open("op.php?op=admin&fp=hintlist&id="+_id+"&mod="+show_mode,'WinPopList','menubar=no,status=yes,scrollbars=no,toolbar=no,top='+Y+',left='+X+',width='+bw+',height='+hi);
	}
}

function w(s) {
	document.write(s);
}

function winonload()
{
	gen_rate0();
	gen_rate1();
	gen_rate2();
	gen_rate2a();
	gen_rate28();
	gen_rate30();
	gen_rate3();
	gen_rate13();
	gen_rate14();
	gen_rate18();
	//gen_rate46();
	gen_rate47();
	gen_rate49();
	gen_rate50();
	bo1_num = document.all.bo1.value-0;
	bo2_num = document.all.bo2.value-0;
	chint_check = document.all.chkhint.checked;
	sound_check = document.all.chksound.checked;
	timer();
}

window.onload = winonload;